#include <bits/stdc++.h>
using namespace std;
int n, k;
const int N = 100010;
int a[N], b[N];

int main() {
	cin >> n >> k;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i];
		b[i] = a[i] + b[i - 1];
	}
	int ans = 0;
	for (int i = 1; i <= n; ++i) {
		for (int j = 0; j < i; ++j) {
			if ((b[i] - b[j]) % k == 0) {
				ans++;
			}
		}
	}
	cout << ans;
	return 0;
}